<?php

class Halls_Thumb_CheckAction extends SrsHallsBaseAction
{
	public function isSecure()
	{
		return false;
	}

	public function executeWrite(AgaviRequestDataHolder $rd)
	{
    $dest = AgaviConfig::get('core.uploads_dir') . '/halls/' . $rd->getParameter('id', 0);

    if (!file_exists($dest))
    {
      mkdir($dest);
    }

    $files = array();

    foreach ($rd->getParameters() as $key => $value)
    {
      if (ctype_upper($key) && strlen($key) === 6 && file_exists($dest . '/' . $value))
      {
        $files[$key] = $value;
      }
    }

    $this->setAttribute('files', $files);

    return 'Success';
	}
}